﻿
using System;
using System.Collections.Generic;
using System.Text;
using Mang24k99.Model.GOLD;
using NHibernate;
using NHibernate.Expression;
using Castle.ActiveRecord.Queries;
using Common;
namespace Mang24k99.Business.GOLD
{
    public partial class BKtGoldSusandres
    {
        /// <summary>
        /// Creates the before.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>if true Cancel</returns>
        private static bool CreateBefore(MKtGoldSusandres model)
        {
            return false;
        }

        /// <summary>
        /// Creates the after.
        /// </summary>
        /// <param name="model">The model.</param>
        private static void CreateAfter(MKtGoldSusandres model)
        {

        }
        /// <summary>
        /// Updates the before.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>if true Cancel</returns>
        private static bool UpdateBefore(MKtGoldSusandres model)
        {
            return false;
        }
        /// <summary>
        /// Updates the after.
        /// </summary>
        /// <param name="model">The model.</param>
        private static void UpdateAfter(MKtGoldSusandres model)
        {

        }

        /// <summary>
        /// Deletes the before.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>if true Cancel</returns>
        private static bool DeleteBefore(MKtGoldSusandres model)
        {
            return false;
        }
        /// <summary>
        /// Deletes the after.
        /// </summary>
        /// <param name="model">The model.</param>
        private static void DeleteAfter(MKtGoldSusandres model)
        {
            ;
        }


        public static MKtGoldSusandres FindAnyOne(int codelist)
        {

            ICriterion[] criteria = new ICriterion[]
            {
                Expression.Eq("MParentKtCommCodelistByBreedCode.CODE_NO",codelist),
            };
            return MKtGoldSusandres.SelectFirst(criteria);
        }


        public static int Count(int codelist)
        {
            ICriterion[] criteria = new ICriterion[]
            {
                Expression.Eq("IsValidate",1),
                Expression.Eq("MParentKtCommCodelistByBreedCode.CODE_NO",codelist),
            };
            return MKtGoldSusandres.Counts(criteria);
        }


    }
}

